package com.neusoft.feature;

import org.junit.Test;

/**
 * @author lichunlong lcl253137@alibaba-inc.com
 * @desc 文本块
 * @date 2023-01-05
 */
public class TextAreaFeature {

    /**
     * JDK 13以前: 需要加\n处理换行
     */
    @Test
    public void test1() {
        String text = "The Sound of silence\n" +
                "Hello darkness, my old friend\n" +
                "I've come to talk with you again\n" +
                "Because a vision softly creeping\n" +
                "Left its seeds while I was sleeping\n" +
                "And the vision that was planted in my brain\n" +
                "Still remains\n" +
                "Within the sound of silence";
        System.out.println(text);

        String html = "<html lang=\"en\">\n" +
                "<head>\n" +
                "    <meta charset=\"UTF-8\">\n" +
                "    <title>java14新特性</title>\n" +
                "</head>\n" +
                "<body>\n" +
                "    <p>hello,atguigu</p>\n" +
                "</body>\n" +
                "</html>";
        System.out.println(html);

        String myJson = "{\n" +
                "    \"name\":\"Song Hongkang\",\n" +
                "     \"address\":\"www.atguigu.com\",\n" +
                "    \"gender\":\"男\"\n" +
                "}";
        System.out.println(myJson);

        String sql = "SELECT id,NAME,email\n" +
                "FROM customers\n" +
                "WHERE id > 4\n" +
                "ORDER BY email DESC";
        System.out.println(sql);
    }

    /**
     * JDK 13: """可以实现文本块默认支持换行，不再通过\n实现
     */
    @Test
    public void test2() {
        String text = """
                The Sound of silence
                Hello darkness, my old friend
                I've come to talk with you again
                Because a vision softly creeping
                Left its seeds while I was sleeping
                And the vision that was planted in my brain
                Still remains
                Within the sound of silence
                """;
        System.out.println(text);

        String html = """
                <html lang="en">
                <head>
                    <meta charset="UTF-8">
                    <title>java14新特性</title>
                </head>
                <body>
                    <p>hello,atguigu</p>
                </body>
                </html>
                """;
        System.out.println(html);

        String myJson = """
                {
                    "name":"Song Hongkang",
                     "address":"www.atguigu.com",
                    "gender":"男"
                }""";
        System.out.println(myJson);

        String sql = """
                SELECT id,NAME,email
                FROM customers
                WHERE id > 4
                ORDER BY email DESC
                """;
        System.out.println(sql);
    }
}
